package com.spc.car.data.service.project.impl;

import com.spc.car.data.domain.htgg.vo.ProjectHtggPublishEditVO;
import com.spc.car.data.domain.htgg.vo.ProjectHtggPublishVO;
import com.spc.car.data.domain.htgg.xml.node.ContractPublish;
import com.spc.car.data.entity.project.ProjectHtggPublish;
import com.spc.car.data.mapper.project.ProjectHtggPublishMapper;
import com.spc.car.data.service.project.ProjectHtggPublishService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * <p>
 * 合同公告数据发布表 服务实现类
 * </p>
 *
 * @author 
 * @since 2020-04-14
 */
@Service
public class ProjectHtggPublishServiceImpl extends ServiceImpl<ProjectHtggPublishMapper, ProjectHtggPublish> implements ProjectHtggPublishService {

    @Override
    public void add(ProjectHtggPublishVO htggPublishVO) {
        ProjectHtggPublish projectHtggPublish = new ProjectHtggPublish();
        projectHtggPublish.setCreateTime(new Date());
        BeanUtils.copyProperties(htggPublishVO, projectHtggPublish);
        saveOrUpdate(projectHtggPublish);
    }

    @Override
    public void edit(ProjectHtggPublishEditVO htggPublishEditVO) {
        ProjectHtggPublish projectHtggPublish = new ProjectHtggPublish();
        projectHtggPublish.setUpdateTime(new Date());
        BeanUtils.copyProperties(htggPublishEditVO, projectHtggPublish);
        saveOrUpdate(projectHtggPublish);
    }

    @Override
    public ContractPublish getHtggInfo(@NotBlank String contractUUID) {
        return baseMapper.getHtggInfo(contractUUID);
    }
}
